@extends('layouts.app')

@section('content')
    <div class="container">

            <div class="col-md-8 mycontainer" >
                <div class="panel panel-default topbar">
                    <div class="panel-body">
                        <li><i class="fa fa-question-circle-o"></i><a href="">提问</a></li>
                        <li><i class="fa fa-mail-reply"></i><a href="">回答</a></li>
                        <li><i class="fa fa-pencil-square-o"></i><a href="">写文章</a></li>
                        <li class="pull-right" style="text-align: right"><a href="">草稿</a></li>
                    </div>
                </div>



                @foreach($questions as $question)
                    <?php $answer = $question->answers->first(); ?>
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div class="feed-titlebar">
                                <a href="{{route('profile.question',$question->user->id)}}" class="pull-left"><img src="{{$question->user->avatar}}" alt=""></a>
                                <a class="pull-left" style="margin-left: 4px">{{$question->user->name}}</a>
                                <span class="pull-left" style="margin-left: 4px">{{$question->user->setting['introduction']}}</span>
                            </div>
                            <div class="feed-item-title">
                                <a href="{{route('question.show',$question->id)}}">{{$question->title}}</a>
                            </div>
                            <div class="feed-item-body">
                                {{mb_substr(strip_tags($answer->body),0,200,"utf-8")}}...
                            </div>
                            <div class="feed-item-actions">
                                <answer-vote-button answer="{{$answer->id}}" count="{{$answer->vote_count}}"> </answer-vote-button>
                                <div class="answer-item-action">
                                <comment commentable_type = 'answer' commentable_id="{{$answer->id}}" count="{{$answer->comment_count}}"></comment>
                                </div>
                                <div class="answer-item-action">
                                    <i class="fa fa-paper-plane fa-icon-sm"></i>
                                    分享
                                </div>
                                <div class="answer-item-action">
                                    <i class="fa fa-ellipsis-h"></i>
                                </div>
                            </div>
                        </div>
                    </div>
                @endforeach
            </div>

        <div class="col-md-4 mycontainer">
            <div class="panel panel-default sidebar1">
                <div class="panel-body">
                    <li><i class="fa fa-bolt" style="color: #a7bd0d"></i><a href="">Live</a></li>
                    <li><i class="fa fa-book" style="color: #00AA00"></i><a href="">书店</a></li>
                    <li><i class="fa fa-podcast" style="color: #00a2d4"></i><a href="">圆桌</a></li>
                    <li><i class="fa fa-pencil" style="color: #0000AA"></i><a href="">专栏</a></li>
                    <li><i class="fa fa-balance-scale" style="color: #0d71bb"></i><a href="">付费咨询</a></li>
                </div>
            </div>
            <div class="panel panel-default sidebar2">
                <div class="panel-body">
                    <li><i class="fa fa-star"></i><a href="">我的收藏</a></li>
                    <li><i class="fa fa-share-alt"></i><a href="">我的邀请</a></li>
                    <li><i class="fa fa-shopping-bag"></i><a href="">我的礼券</a></li>
                    <li><i class="fa fa-support"></i><a href="">社区服务中心</a></li>
                    <li><i class="fa fa-sun-o"></i><a href="">版权服务中心</a></li>
                    <li><i class="fa fa-plug"></i><a href="">公共编辑动态</a></li>
                </div>
            </div>

        </div>

    </div>
@endsection
